//
//  BSoftLogService.h
//  BSoftWorkLog
//
//  Created by zarra on 2017/8/3.
//  Copyright © 2017年 zarra. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
#import <XMLDictionary/XMLDictionary.h>
#import <NSHash/NSString+NSHash.h>
#import <NSHash/NSData+NSHash.h>
#import <XMLDictionary/XMLDictionary.h>
#import "GRMustache.h"

#import "BSoftProject.h"
#import "BSoftWorkLog.h"

extern NSString* CmdServletURL;
extern NSString* CommandServiceServletURL;
extern NSString* DealDataServletURL;
extern NSString* SaveLogInfoURL;
extern NSString* KeyUserName;
extern NSString* KeyPassword;


typedef enum {
    UnknowErr = 0,
    LackUsernameOrPassword = -1000,
    ErrUsernameOrPassword,
    ErrResponse,
    ErrLogin,
    ErrNetwork
}LinkupClientErrorFailed;




@interface BSoftLogService : NSObject

@property (copy,nonatomic) NSString* sessionID;
@property (copy,nonatomic) NSString* msID;
@property (strong,nonatomic) BSoftProject* project;

+(BSoftLogService*)shareInstance;
-(id)getVarForKey:(NSString*)key;
-(void)putVar:(id)value forKey:(NSString*)key;
-(void)postData:(NSURL*)url data:(NSData*)data completionHandler:(void(^)(NSURLResponse * response , id responseObject, NSError * error)) handler;
-(void)postData:(NSURL*)url xmlData:(NSString*)xml completionHandler:(void(^)(NSURLResponse * response , NSString* responseObject, NSError * error)) handler;
-(BOOL)isUserNameAndPasswordOK;
-(void)userLogin:(NSString*)username password:(NSString*)password completionHandler:(void(^)(NSError* error))handler;
-(void)queryLastProject:(NSString*)username completionHandler:(void(^)(NSDictionary* dict,NSError* error))handler;
-(void)getTodayLog:(NSString*)username completionHandler:(void(^)(NSString* rsp,NSError* error))handler;
-(void)saveWorkLog:(BSoftWorkLog*)workLog completionHandler:(void(^)(NSDictionary* dict,NSError* error))handler;
@end
